package chain;
/**
 * 我们这边定一个审批的抽象类，里面定义处理的等级
 * @author zj
 *
 */
public abstract class Approval {

	private  int one=1;
	private int two=2;
	private int three=3;
	   protected int level;//定一个一个等级，
	   private Approval next;//责任链中下一元素
	   public void setNextApproval(Approval next){
		      this.next = next;
		   }
	
	   public void writeMessage(int level,String message) {
		   if(this.level >= level){
		         write(message);
		      }
		   if( next !=null){
		         next.writeMessage(level, message);
		      }
	   }
	   //定义一个抽象的写消息的方法
	   abstract protected void write(String message);
}
